home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
graphics
/
3dvect37.zip
/
OBJECTS.INC
< prev
next >
Wrap
Text File
|
1994-06-22
|
67KB
|
1,703 lines
;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
;
; Filename : objects.inc
; Included from: Main.asm
; Description : Some sample objects for 3dVect.zip
;
; Written by: John McCarthy
; 1316 Redwood Lane
; Pickering, Ontario.
; Canada, Earth, Milky Way (for those out-of-towners)
; L1X 1C5
;
; Internet/Usenet: BRIAN.MCCARTHY@CANREM.COM
; Fidonet: Brian McCarthy 1:229/15
; RIME/Relaynet: ->CRS
;
; Home phone, (905) 831-1944, don't call at 2 am eh!
;
; John Mccarthy would really love to work for a company programming Robots
; or doing some high intensive CPU work. Hint. Hint.
;
; Send me your protected mode source code!
; Send me your Objects!
; But most of all, Send me a postcard!!!!
;
;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
; include knight.inc
; include stuka.inc
; include tank.inc
include acad1.inc
setupbase:
mov objbase[0*4],offset headercube4
mov objbase[1*4],offset headercube2
mov objbase[2*4],offset headerring
mov objbase[3*4],offset headerdiamond
mov objbase[4*4],offset headerrubine
mov objbase[5*4],offset column
mov objbase[6*4],offset archmiddle
;mov objbase[7*4],offset archend
;mov objbase[8*4],offset bigoildrum
;mov objbase[9*4],offset ship1
mov objbase[5*4],offset headercube3
mov objbase[6*4],offset headerarm
;mov objbase[0*4],offset platform1
;mov objbase[1*4],offset platform2
;mov objbase[2*4],offset platform3
;mov objbase[3*4],offset ship1
;mov objbase[0*4],offset headerknight
;mov objbase[0*4],offset stuka
;mov objbase[0*4],offset turret
;mov objbase[0*4],offset futurecrewrip1
;mov objbase[0*4],offset formula
;mov objbase[0*4],offset inca
mov objbase[0*4],offset hacad1
;mov objbase[1*4],offset hacad1
;mov objbase[2*4],offset hacad1
;mov objbase[3*4],offset hacad1
;mov objbase[4*4],offset hacad1
;mov objbase[5*4],offset hacad1
;mov objbase[6*4],offset hacad1
;mov objbase[7*4],offset hacad1
mov esi,0 ; from object #
mov edi,6 ; to object #
call set_up_all_lambert ; find and set up shading tables
ret
;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
; Shape data can be almost as large as you need it 'till it crashes. Try a cube
; 20000x20000x20000. Calculations use 32 bit registers and can handle
; up to 16 bit locations. Keeping the object size small will allow a larger
; visible space. But larger objects will allow you to get closer with more
; accuracy in the mathematics of rotations. Remember, if you make a really big
; object, set minz to the largest object on the screen so the large object wont
; mess up when you get really close to it. I have generally found that larger
; objects "look" better as they have great mathematical resolution.
;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
;
; Format for objects:
;
; headerthing:
; dd max,min ; max = maximum distance object can be seen, min = closest
; ; distance object is allowed to be seen (can be negative)
; ; eg dd 5000000,200. If negative, object must be made up
; ; of only sub-objects!!!
; dd res1 ; distance for resolution1, eg 6000
; dd offset thing1 - offset $ - 4 ; pointer to resolution1
; dd -1 ; last resolution flag
; dd offset thing2 - offset $ - 4 ; pointer to resolution2
;
; thing1:
; dw xx ; number of points
; dw yy ; number of surfaces
; dw 25 dup (0) ; 25 future use words/options
;
; dw xx,yy,zz ; x,y,z of point 0
; dw xx,yy,zz ; x,y,z of point 1
; dw xx,yy,zz ; x,y,z of point 2
; ...
;
; dw command
; dw texture for side 1
; dw texture for side 2
; dw colour for side 1
; dw colour for side 2
; dw connection data eg (1,2,3,4,1)
; dw [?,?,?] [optional surface normal if command 128 used]
; dw more connection data...
;
; to re-cap: dw command,texture1,texture2,colour1,colour2,connection,[0,0,0]
;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
;
; List of texture bits to date: (options grouped by function:)
;
; Note: "visible" = "points appear counter-clockwise"
;
; Texture definitions:
;
; 0 - normal surface, no features, constant colour.
; wavey - steel texture for surface 0 = none, colour offset determines
; screen offset for texture. eg 16+7 will use colour block 16-31
; but make the sine wave texture 14 (7*2) lines down. this is so
; all sine wave textures do not appear on the same line. Windows
; and engines look good with this feature. This option can be
; combined with shading if you want to mis-align sine wave
; patterns.
; shade - lambert shading bit, must have normal calculated or at least
; have free space for pre_cal_lambert to use:
; eg x,x,x,x,x,1,2,3,1,?,?,?<- these 3 words are surface normal!
; inverse - inversion bit for shading option. 0=normal shading, 1=inverse
; inversion automatically occures when other side is displayed.
; glow - =shade+inverse
; last - colour has same colour as previous surface (used when
; you want gourad shading, but want to avoid duplicate
; calculations - don't set gourad bit if this is what
; you use it for.) when this is used, the colour number
; determines the new colour block to use. the shading
; of this colour will be the same as the surface before
; it, but the colour block can be different.
; mesh - see the line below? that sort if dot on/dot off thing? thats a
; mesh texture. can be combined with shading.
; glenz - glenz vector (you know, the stained glass type of thingy)
; The colour of surface refers to a cross referanced palette
; from which the glenz polygon will derive it's new colours.
; Put the cross referancing palette offset into xreftable
; and make the colour index the palette in the table. Glenz
; vectors can be used with the shading option to get the
; same type of effect as in Second Unreal. Shaded Glenz
; Vectors are made by simply having multiple cross referance
; palettes and setting the surface to "shade". This will
; select the appropriate table based on surface normal. This
; option can be combined with shading.
; stone - this texture is like the stone texture I saw in Alone In The
; Dark. The stone texture offset is loaded from
; [stonetbl+colour*4]. Use the Qbasic program stone.bas to
; generate more stone textures with different colours or ranges
; This option can be combined with shading.
;
;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
;
; Commands:
;
; point - defines a single point; must be repeated! eg dw 64,col,3,3
; line - if used, defines a line (must be set to define a true line)
; himap - if set, defines a bitmap,eg: point #, bitmap #, x scale,y scale
; lomap - uses 1/4 scaled bitmap (every 4'th pixel is sampled), fast
;
; iterate - generate iteration if side visible (iteration = sub-object)
; matrix - modify matrix when generating iteration. matrix object
; offset is 3rd word (6'th byte) in future use words.
;
; both - side is always visible no matter angle, skips counter-clowise test
; - "both sides have same texture"
; double - side is always visible but other side has other colour
; "double sided surface"
; note: if this is used, option "both" must not be used!!
; onscr - test if side is on screen - don't use if all points are
; outside clipping parameters.
; check - dont plot this side, just use as test points for visibility.
; this is mostly used with iterations.
; gosub - push current offset and go to another location (offset location - offset $)
; return - just like a qbasic return
; goto - like qbasic - go to another offset (offset location - offset $)
; push_matrix - push rotation matrix
; pop_matrix - pop rotation matrix
; push_location - push 3d centriodal location
; pop_location - pop 3d centroidal location
; sub_object - sub_object = matrix+check+iteration+both,?,?,?,?,0,0
; static_sub_object - non-rotatable sub_object = check+iteration+both,?,?,?,?,0,0
;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
;
; There are two kinds of bitmaps and points. Those which are inside objects
; and those which are seperate objects themselves. If userotate object command
; is set to 32 or 64, then the entire object is considered to be either a point
; or bitmap. But if userotate is not set this way, then a normal object is
; drawn and bitmaps then come from within the object definitions (below). this
; way, bitmaps and points can be either part of a larger object, or they are
; computed fast on their own. (eg explosions and bullets as seperate objects)
;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
;
; Note: when writing surface descriptions, try to make the first value unique
; from any other first value. This way, the sort routine will give a more
; accurate sorting of sides. eg 1,3,6,1 2,4,1,2 rather than 1,3,6,1 1,2,4,1
; If this doesnt give you what you want, then try making the first two points
; the farthest points from the objects centroid.
;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
;
; To recap:
;
; 0 = constant colour, only visible from counter-clockwise side
; wavey = sine texture
; shade = shading - requires 3 blank words for surface normal eg dw 0,0,0
; inverse = invert the shading direction, 0=normal, 1=sun is other way.
; last = use intensity from previous surface (not colour, only intensity)
; mesh = see through mesh - solid colour
; glenz = cross referancing vector - load from screen, xrefs it, put back
; stone = stone texture. use stone.bas to make more textures.
;
; point = point
; line = line
; himap = bitmap (scalable, non-rotatable)
; lomap = bitmap (scalable, non-rotatable)
; iterate = generate iteration if side visible
; both = always visible
; double = always visible but other side has high byte colour,"double sided"
; onscr = plot side only if all the following points are on the screen
; check = dont plot side but use the following points as a test for visiblity
;
; What you can't mix on a single surface: "double" with "both"!!
;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
;
; You do not have to define a point for the center of the object. the point
; 0 defines the center of the object. This is different from earlier versions
; This point will ALWAYS be calculated and will always be the zero'th point.
;
; Iterations may or may not have an extra centroid point calculated for you.
; Whether or not a new point is added to the points list is dependant on
; whether or not a new centroid must be calculated. Hmmm, how can I explain
; this...Ok, centroids are calculated with new maxtricies or centroid offsets,
; they are also calculated if the centroid flag is set (4'th word). So, what
; does this mean to the lowly reader (you). Some examples of iterations where
; new points are added to points list.
;
; Eg:
; an iteration where new centroid IS NOT calculated and IS NOT inserted
;
; dw iteration,0,0,colour,0 ,1,2,3,4,1
; dw 1,1
; dw 25 dup (0)
; x y z
; dw 5,5,5 ; point 20 (for example)
; dw 0,0,0,colour, 20,5,20 ; notice how this surface uses newly created point
;
; an iteration where new centroid IS calculated and IS inserted
;
; dw iteration+matrix,0,0,colour,0 ,1,2,3,4,1
; dw 1,1
; dw 25 dup (0)
; x y z
; dw 5,5,5 ; point is now 21 (because matrix calculated new centroid)
; dw 0,0,0,colour, 21,5,21 ; same surface as above.
;
; The "sub_object" command also forces a centroid to be calculated, and will
; also insert a new point into the points list. Be aware of it's presance!
;
; Note: The centroid is always calculated as the zero'th point. The above rules
; only apply to whether or not a new centroid will appear as an EXTRA point
; in an ITERATION.
;
; Questions to ask yourself in trying to figure out the above text:
; Have I made an iteration that has any centroidal offset?
; Have I used the matrix command?
; Hahe I used the sub_object command?
; Have I set bit 0 of the 4'th word in the 25 dup's to 1?
; Am I sexually frustrated?
; If you answer yes to any of these questions, then a new centroidal point will
; be calculated and inserted into the points list even if you dont ask for it!
;
; If you want to negate the effects of centroid point insertion, simply set
; the 8'th word (16'th byte) in those 25 dup's to 1. See below for more info.
;
;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
;
; Here is a simple rundown of what those 25 extra words do:
;
; dw x,y ; x=number of points,y=number of surfaces (but you knew that right?)
;
; dw ? ; reserved for memory offset if an iteration is skipped (leave blank)
; dw ? ; reserved for point offset if an iteration is skipped (leave blank)
; dw ? ; reserved,is there a new center of gravity to calculate? (leave blank)
; ; you could force this value to 1 (centroid in equ.inc) if you wanted
; ; to have a new centroid calculated with the iteration.
; dw x,y,z ; new center-of-gravity point. lets say you want a subsurface to
; ; be offset by a certin spacial location, you can set these 3 words
; ; to be "added" to any points you are adding to the sub-object
; ; listen bub, just mess around with it and you'll get the idea...
; dw # ; new load object offset for matrix compounding - this is only used
; ; if the sub-object has a new matrix. (for rotation). commands like
; ; matrix and sub_object access this word to determine where in the
; ; object lists (xs,ys,zs,xadds,zadds...) to get the location and
; ; rotation information about the sub-object. check out the block
; ; with the two smaller rotating blocks and then look in main.asm
; ; to figure out how to use this. usual values are 1 or 2, maybe 3
; ; up to the number of extra sub_objects you've got.
; dw # ; connection data addition value. this value gets added to the
; ; connection data. eg: lets say you've got an object that starts at
; ; point 3 and goes to 12, but you want to make it into a sub_object
; ; (part of something larger) and you want to change the connection
; ; data to have a range of 25 to 36. just put the value 22 in here
; ; and all connection data within the object (and all sub_objects,
; ; even in sub_objects within sub_objects) will have this value
; ; added to it. this is usefull for, lets say, making a formation
; ; of airplanes one big object instead of drawing each individual
; ; airplane. (if by some freak accident you wanted to do that)
; dd # ; maximum distance object can be seen (maxz)
; dd # ; minimum distance object can be seen (minz) - this can be negative
; ; if you want. but if it is negative, the entire object must
; ; be made up of sub-objects. If these are left at zero, they will
; ; be forced to good values (pre_cal_lambert does this).
; dd # ; screen tolerancing. this is used to determine how far off the
; ; screen an object will remain visable. past this, the object will
; ; not be drawn. try 1, then try 500. you'll get the idea. (get
; ; close to the object.) if this is left blank, a value will be
; ; placed in for you.
; dw 11 dup 0 ; future use bytes
;
; To re-cap, the 25 word header looks like this:
;
;offset │length&type │description
;───────────────┼───────────────┼──────────────────────────────────────────────
; 0 │1 word (resrvd)│offset to next iteration (skip entire iteration)
; 2 │1 word (resrvd)│number of points in entire iteration
; │ │
; 4 │1 word (resrvd)│centroid flag (bit 0)
; 6 │3 words x,y,z │new centroid for points (and all following iterations!)
; 12 │1 word │"new object angle" matrix load location (from vxs[],vys[]... (single,eg: 1,2,3...)
; 14 │1 word │connection data addition value (can be negative!)
; 16 │1 dword │maximum distance object can be seen (maxz)
; 20 │1 dword │minimum distance object can be seen (minz)
; 24 │1 dword │screen tolerancing
; │ │
; 28 │11 words │future use
;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
align 16
headercube1 dd -1
dd offset cube1a - offset $ - 4
cube1a dw 8 ; how many points
dw 6 ; how many surfaces
dw 25 dup (0) ; future use
; x y z
dw -270, 270, 270 ;1
dw -270,-270, 270 ;2
dw 270,-270, 270 ;3
dw 270, 270, 270 ;4
dw -270, 270,-270 ;5
dw -270,-270,-270 ;6
dw 270,-270,-270 ;7
dw 270, 270,-270 ;8
dw 0,0,0,16*9+12 ,0 ,1,2,3,4,1 ; surface connection data, and colours
dw 0,wavey,0,16*7+6 ,0 ,8,7,6,5,8 ; end point=start point means done side
dw 0,wavey,0,16*3+9 ,0 ,4,3,7,8,4
dw 0,shade,0,16*5+0 ,0 ,5,6,2,1,5 ,0,0,0 ;<-- lambert shading